package microcredit.gui.action;

import java.awt.Component;
import java.awt.event.ActionEvent;

import javax.swing.AbstractAction;
import javax.swing.ImageIcon;
import javax.swing.JOptionPane;

public class ExitAction extends AbstractAction {

	private static final long serialVersionUID = 1L;
	
	public ExitAction() {
		putValue(NAME, "<html>Exit <font size='-4'>(ALT+F4)</font>");
		putValue(SMALL_ICON, new ImageIcon(AboutAction.class.getResource("/microcredit/icons/x16/exit.png")));
	}
	
	
	
	public void actionPerformed(ActionEvent e) {
		int option = JOptionPane.showConfirmDialog(JOptionPane.getFrameForComponent((Component)e.getSource()), "Do you really want to exit?");
		if (option == JOptionPane.YES_OPTION) {
			System.exit(0);
		}
	}
}